Last Update: 2025/3/26
LLMVision Speech API
The LLMVision Speech API allows you to convert text to speech using OpenAI's SDK. This document provides an overview of the API endpoints, request parameters, and response structure.
Endpoint
POST https://platform.llmprovider.ai/v1/audio/speech
Request Headers
Header | Value |
---|---|
Authorization | Bearer YOUR_API_KEY |
Content-Type | application/json |
Request Body
The request body should be a JSON object with the following parameters:
Parameter | Type | Description | Note |
---|---|---|---|
model | string | The model to use (e.g., SenseTTS-Fusion-20250324 ). | |
input | string | The text to generate audio for. The maximum length is 4096 characters. | |
voice | string | The voice to use (girl_naisheng , girl_pingjing , girl_yingqi or guy_qingshuang ). | View the full voice list |
response_format | string | (Optional) The format of the audio response (mp3 , wav , wav_stream ). | wav_stream : 流式音频返回. |
speed | number | (Optional) The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default. | |
language | string | (Optional) The language of the input text. | |
volume | number | (Optional) The volume of the generated audio. Select a value from 0.0 to 1.0. 1.0 is the default. | |
pitch | number | (Optional) The pitch of the generated audio. Select a value from -1.0 to 1.0. 0.0 is the default. | |
stream | bool | (Optional) Whether to return the audio as a stream. Default is false . | |
reference_voice_wav | string | (Optional) The file path of the reference WAV audio. | 参考音频 |
timber_weights | map[string]float | (Optional) The file paths and corresponding weights of WAV audio generated by the Sovits model.(must be = 1) | 融合音频 |
Example Request
{
"model": "SenseTTS-Fusion-20250324",
"input": "人之初,性本善",
"voice": "guy_shuaiqi"
}
Response
The API returns an audio file in the requested format.
Example Request
- Shell
- nodejs
- python
curl -X POST https://platform.llmprovider.ai/v1/audio/speech \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "SenseTTS-Fusion-20250324",
"input": "Hello, how are you today?",
"voice": "girl_naisheng",
}' \
--output speech.mp3
const axios = require('axios');
const fs = require('fs');
const apiKey = 'YOUR_API_KEY';
const url = 'https://platform.llmprovider.ai/v1/audio/speech';
const data = {
model: 'SenseTTS-Fusion-20250324',
input: 'Hello, how are you today?',
voice: 'girl_naisheng'
};
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
'responseType': 'arraybuffer'
};
axios.post(url, data, { headers })
.then(response => {
fs.writeFileSync('speech.mp3', response.data);
console.log('Audio file saved as speech.mp3');
})
.catch(error => {
console.error('Error:', error);
});
import requests
api_key = 'YOUR_API_KEY'
url = 'https://platform.llmprovider.ai/v1/audio/speech'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
data = {
'model': 'SenseTTS-Fusion-20250324',
'input': 'Hello, how are you today?',
'voice': 'girl_naisheng',
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
with open('speech.mp3', 'wb') as f:
f.write(response.content)
print('Audio file saved as speech.mp3')
else:
print('Error:', response.status_code, response.text)
For any questions or further assistance, please contact us at [email protected].